//
//  ZhongZhiTableViewController.m
//  明和智能
//
//  Created by 李李善 on 2018/8/24.
//  Copyright © 2018年 inno. All rights reserved.
//

#import "ZhongZhiTableViewController.h"
#import "ZhongZhiTableViewCell.h"
#import "UIBarButtonItem+Extension.h"
@interface ZhongZhiTableViewController ()<MCImageScrollViewDelegate>

@end

@implementation ZhongZhiTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    UIBarButtonItem *rightItem = [UIBarButtonItem OnCreateBarBtnItemName:@"充值说明" BarBtnstyle:(RightBarBtnItemStyle) Btntag:10 target:self action:@selector(onRightBtn:)];
    UIButton *button = [rightItem.customView viewWithTag:10];
    button.titleLabel.font = kSysFont(kFitW(12));
    [button setNormalTitleColor:[UIColor whiteColor]];
    self.navigationItem.rightBarButtonItem =rightItem;
  
}

-(void)onLoadViewByWillAppear:(UIView *)view
{
    [self.tableView config:^(UITableView *tableView) {
        tableView.backgroundColor = hexCOLOR(@"ECECEC");
        tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    }];
    
}
-(void)onLoadAnimatedByDidAppear:(id)model
{
    UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:1]];
    cell.selected = YES;
}
-(void)onRightBtn:(UIButton *)button
{
    
}
-(void)imageScrollView:(UICollectionView *)collectionView imageCellAtIndexPath:(NSIndexPath *)indexPath
{
    UICollectionViewCell *cell = [collectionView cellForItemAtIndexPath:indexPath];
    cell.highlighted = YES;
    
}
//设置点击高亮和非高亮效果！
- (BOOL)collectionView:(UICollectionView *)collectionView shouldHighlightItemAtIndexPath:(NSIndexPath *)indexPath
{
    return YES;
}
-  (void)collectionView:(UICollectionView *)collectionView didHighlightItemAtIndexPath:(NSIndexPath *)indexPath
{
    UICollectionViewCell *cell = [collectionView cellForItemAtIndexPath:indexPath];
    [cell setBackgroundColor:[UIColor lightGrayColor]];
}
- (void)collectionView:(UICollectionView *)collectionView didUnhighlightItemAtIndexPath:(NSIndexPath *)indexPath
{
    UICollectionViewCell *cell = [collectionView cellForItemAtIndexPath:indexPath];
    [cell setBackgroundColor:[UIColor whiteColor]];
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    if (section==0) {
        return 2;
    }
    return 2;
}
#pragma mark - Table view data source

-(void)onSetSubviewSELForCell:(BaseTableViewCell *)cell forTableView:(UITableView *)tableView forIndexPath:(NSIndexPath *)indexPath
{
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
//    if (indexPath.section==1&&indexPath.row==0) {
//        [cell setSelected:YES animated:NO];
//    }
//    
}

-(MCCellInfo *)tableView:(UITableView *)tableView cellForIndexPath:(NSIndexPath *)indexPath IsHeight:(BOOL)isheight
{
    if (indexPath.section==0) {
        if (indexPath.row==0) {
            return [MCCellInfo configForCellId:cell Class:[ZhongZhiTableViewCell class] Height:kFitH(130) TableView:tableView];
            
        }
        else
        {
            return [MCCellInfo configForCellId:cell2 Class:[ZhongZhiTableViewCell1 class] Height:kFitH(70) TableView:tableView CellStyle:(UITableViewCellStyleSubtitle)];
        }
    }
    else
    {
        
            return [MCCellInfo configForCellId:cell3 Class:[ZhongZhiTableViewCell2 class] Height:kFitH(50) TableView:tableView];
    }
    
    
    
}

-(MCHFViewInfo *)tableView:(UITableView *)tableView HeaderInSection:(NSInteger)section isBiao:(BOOL)isBiao
{
    return [MCHFViewInfo configForViewId:header0 Class:[ZhongZhiHeaderFooterView class] Height:kFitH(55) TableView:tableView];
}

-(id)modelForIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section==1) {
        return indexPath.row==0?@{@"imageName":@"pay_weixin_icon",@"title":@"微信"}:@{@"imageName":@"pay_zhifubao_icon",@"title":@"支付宝"};
    }
    return nil;
}
-(id)headerViewModelForSection:(NSInteger)section
{
    if (section==0) {
        return @"选择充值面额";
    }
    return @"选择支付方式";
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
@end
